import request from '@/utils/request'

// 创建项目
export function createProjectApi(data){
	return request({
		url: '/crm/project/create',
		method: 'POST',
		data: data
	})
}
// 获取项目列表
export function getProjectListApi(data){
	return request({
		url: '/crm/project/page',
		method: 'GET',
		data: data
	})
}
// 获得项目详情
export function getProjectDetailApi(id){
	return request({
		url: `/crm/project/get?id=${id}`,
		method: 'GET'
	})
}
// 更新项目
export function updateProjectApi(data){
	return request({
		url: '/crm/project/update',
		method: 'PUT',
		data: data
	})
}
// 获得项目成员列表
export function getMemberListApi(data){
	return request({
		url: '/crm/permission/list',
		method: 'GET',
		params:data
	})
}
// 添加项目成员
export function addProMemberApi(data){
	return request({
		url: '/crm/permission/project/create',
		method: 'POST',
		data: data
	})
}
// 删除项目数据权限
export function deleteProMemberApi(id){
	return request({
		url: `/crm/permission/project/delete?id=${id}`,
		method: 'DELETE'
	})
}
// 创建实施申请
export function createImplementApi(data){
	return request({
		url: '/crm/project-carry-out/create',
		method: 'POST',
		data: data
	})
}
// 获取实施详情
export function getImplementApi(id){
	return request({
		url: `/crm/project-carry-out/get?id=${id}`,
		method: 'GET',
	})
}
// 交付项目
export function deliverProjectApi(data){
	return request({
		url: '/crm/project/deliver',
		method: 'PUT',
		data: data
	})
}
// 暂停项目
export function pauseProjectApi(id){
	return request({
		url: `/crm/project/pause?id=${id}`,
		method: 'PUT'
	})
}
// 申请暂停项目
export function applyPauseProjectApi(data){
	return request({
		url: '/crm/project/pause/apply',
		method: 'PUT',
		data: data
	})
}
// 恢复项目
export function restoreProjectApi(id){
	return request({
		url: `/crm/project/restore?id=${id}`,
		method: 'PUT'
	})
}
// 删除项目
export function deleteProjectApi(id){
	return request({
		url: `/crm/project/delete?id=${id}`,
		method: 'DELETE'
	})
}
// 作废项目
export function repealProjectApi(id){
	return request({
		url: `/crm/project/invalidate?id=${id}`,
		method: 'PUT'
	})
}
// 申请作废项目
export function applyRepealProjectApi(data){
	return request({
		url: '/crm/project/invalidate/apply',
		method: 'PUT',
		data: data
	})
}
// 申请归档项目
export function applyDocumentProjectApi(data){
	return request({
		url: '/crm/project/file/apply',
		method: 'PUT',
		data: data
	})
}
//移交项目
export function ProjectTransferApi(data){
	return request({
		url: '/crm/project/transfer',
		method: 'PUT',
		data: data
	})
}
// 创建项目实施进展
export function createProgressApi(data){
	return request({
		url: '/crm/project-carry-out-progress/create',
		method: 'POST',
		data: data
	})
}
// 获得实施进展列表
export function getProgressListApi(data){
	return request({
		url: '/crm/project-carry-out-progress/page',
		method: 'GET',
		params: data
	})
}
// 获取项目审批记录
export function getProjectTaskRecodeApi(data){
	return request({
		url: '/bpm/task/manager-page',
		method: 'GET',
		params: data
	})
}
// 根据项目id获得项目实施详情
export function getCarryOutApi(id){
	return request({
		url: `/crm/project-carry-out/get-by-project-id?projectId=${id}`,
		method: 'GET'
	})
}
